package utilities;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;

public class JPanel2 extends JPanel {
	private Image ic;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public JPanel2(Image ic) {
		this.ic = ic;

	}

	public void paintComponent(Graphics g) {
		Dimension panelSize = getSize();
		int altezza = ic.getWidth(this);
		int larghezza = ic.getHeight(this);

		for (int y = 0; y < panelSize.height; y += larghezza) {
			for (int x = 0; x < panelSize.width; x += altezza) {
				g.drawImage(ic, x, y, this);
			}
		}
	}

}
